<?php

namespace app\api\controller;
use think\facade\Db;
use think\facade\Request;
use app\admin\controller\Admin;
use app\api\model\Category as CategotyModel;
class Category
{
    public function categoryList()
    {
        $data=input();
        $page = $data['page'] ?? 1;
        $pageSize = $data['pageSize'] ?? 10;
        $keyword = $data['keyword'] ?? '';
        $result = CategotyModel::getCategoryList($page, $pageSize, $keyword);
        return json($result);
    }

    public function categoryAdd()
    {
        $data=input();
        $result = CategotyModel::addCategory($data);
        return json($result);
    }

    public function categoryEdit()
    {
        $data=input();
        $result = CategotyModel::editCategory($data);
        return json($result);
    }

    public function categoryDel()
    {
        $id=input('id');
        $result = CategotyModel::deleteCategory($id);
        return json($result);
    }

}